package Text_36;

import java.util.HashSet;
import java.util.LinkedHashSet;

public class Code {

	public static void main(String[] args) {
		 Student s1 = new Student("king",12);
	        Student s2 = new Student("tom",13);
	        Student s3 = new Student("ta",14);
	        Student s4 = new Student("king",12);
	        //无序
	        HashSet<Student> hs = new HashSet<>();
	        hs.add(s1);
	        hs.add(s2);
	        hs.add(s3);
	        hs.add(s4);
	        for(Student s : hs){
	            System.out.println(s+" ");
	        }
	        System.out.println(hs);
	        //有序
	        LinkedHashSet<Student> lh = new LinkedHashSet<>();
	        lh.add(s1);
	        lh.add(s2);
	        lh.add(s3);
	        lh.add(s4);
	        System.out.println(lh);


	}

}
